#ifndef __WS2812_H
#define __WS2812_H

#include "main.h"
#include "tim.h"
 
#define WS_H           60   // 1 码相对计数值
#define WS_L           29   // 0 码相对计数值
#define WS_REST        40   // 复位信号脉冲数量
#define LED_NUM        16   // WS2812灯个数
#define DATA_LEN       24   // WS2812数据长度，单个需要24个字节
#define WS2812_RST_NUM 50   // 官方复位时间为50us（40个周期），保险起见使用50个周期
 
 typedef struct {
uint8_t sta;
	uint16_t time;
	uint16_t time_last;
	uint8_t sum;
}RB_Buff;
 
typedef struct{
	uint8_t R;
	uint8_t G;
	uint8_t B;
	
}RGB_Buff;

extern enum{
	R=1,
	G,
	B
}RGB_ENUM;
 
void WS2812_Init(void);
void WS2812_Set(uint16_t num,uint8_t R,uint8_t G,uint8_t B);
uint8_t RainbolFunc(RB_Buff *RB,uint16_t fri);
void WS2812_Set_ALL(uint8_t R,uint8_t G,uint8_t B);
uint8_t PM_Func(uint8_t channel);

#endif
